<?php
class MeansController extends AppController {
	public $uses = array('Mean');
	public function admin_index($mean_id = null) {
		$means = $this->Mean->find('all');
		$this->set('means', $means);
	}
	
	public function admin_edit($mean_id = null){
		if($this->request->is('post')){
			if($this->Mean->save($this->request->data['Mean'])){
				$this->Session->setFlash(__('Update successful'));
				$this->redirect('index');
			}
			else{
				$this->Session->setFlash(__('Update failed'));
			}
		}
		if(!empty($mean_id)){
			$this->Mean->id = $mean_id;
			$this->set('mean', $this->Mean->read());
		}
	}
	public function admin_add(){
		if($this->request->is('post') && !empty($this->request->data)){
			if($this->Mean->save($this->request->data['Mean'])){
				$this->Session->setFlash(__('Update successful'));
				$this->redirect('index');
			}
			else{
				$this->Session->setFlash(__('Update failed'));
			}
		}
	}
	
	public function admin_addPrice(){
		
	}
	
	public function admin_delete($mean_id = null){
		if(!empty($mean_id)){
			$this->Mean->delete($mean_id);
			$this->Session->setFlash(__('Delete successful'));
			$this->redirect('index');
		}
		
	}
}